<template>
<div class="Guess">
    <div class="cnxh" :class="[gd]">
        <div class="caini" :class="[dw]">
            猜你喜欢
        </div>
    </div>

    <router-link tag="div" class="guess-a" v-for="item of Guesslist" :key="item.id" :to='"/detail/"+item.id'>
        <div class="Guess-img">
            <img :src="item.imgUrl" />
            <div class="Guess-desc">
                {{item.desc}}
            </div>

        </div>
        <div class="Guess-desc1">
            {{item.desc1}}
        </div>
        <div class="Guess-gl">
            <div class="gl-flet">
                {{item.desc2}}
            </div>
            <div class="gl-right">
                <span>￥{{item.desc3}} </span>起
            </div>
        </div>
    </router-link>
</div>
</template>

<script>
//	定义输出组件name
export default {
    name: 'homeGuess',
    props: {
        Guesslist: Array
    },
    data() {

        return {
            gd: "",
            dw: "",

        }
    },
    methods: {
        scrollChange() {
            //   定义滚动距离
            let height = document.documentElement.scrollTop
            // console.log(height)
            if (height > 500) {
                this.gd = "gd"
                this.dw = "dw"
            } else {
                this.gd = ""
                this.dw = ""
            }
        }
    },
    mounted() {
        //   定义监听滚动事件
        window.addEventListener('scroll',
            this.scrollChange)
    }
}
</script>

  <!--给css样式设置语言工具stylus-->

<style scoped>
.caini {
    border-bottom: rgb(130, 190, 9) solid 2.5px;
    height: 20px;
}

.Guess {
    margin-top: 3px;
    overflow: hidden;
    width: 100%;
    height: 0;
    padding-bottom: 350%;
    background-color: rgb(250, 249, 249);
    position: relative;
}

.cnxh {

    position: absolute;
    top: 3%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 40px;
    color: rgb(77, 146, 7);
    z-index: 100;
}

.gd {
    position: fixed;
    top: 7%;

    background-color: #fff;
    width: 101%;
    /* text-align: center; */
}

.dw {
    /* margin: 0 auto; */
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

}

.guess-a {
    margin-top: 2px;
}

.Guess-img {
    position: absolute;
    top: 45px;
    clear: both;
    position: relative;
}

.Guess-img img {
    width: 100%;
    height: 200px;
    z-index: -1;
}

.Guess-desc {
    position: absolute;
    bottom: 0px;
    background-color: rgb(149, 149, 149);
    opacity: 0.7;
    height: 10%;
    width: 100%;
    color: #ffffff;
}

.Guess-desc1 {
    height: 20px;
    width: 300px;
    margin-top: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;

    word-wrap: break-word;
}

.Guess-gl {
    margin-top: 10px;
    width: 100%;
    height: 10px;
}

.gl-flet {
    float: left;
}

.gl-right {
    float: right;

}

span {
    color: rgb(153, 10, 10);
}
</style>
